package com.zzxx.userManagement.service.impl;

import com.zzxx.userManagement.dao.UserDao;
import com.zzxx.userManagement.dao.impl.UserDaoImpl;
import com.zzxx.userManagement.domain.User;
import com.zzxx.userManagement.service.UserService;
import com.zzxx.userManagement.utils.IdOrPwdException;

public class UserServiceImpl implements UserService {
    private UserDao userDao = new UserDaoImpl();
    @Override
    public User login(String user, String password) throws IdOrPwdException {
        User loginUser = userDao.findUserByNameAndPwd(user, password);
        if (loginUser == null) {
            throw new IdOrPwdException("账号或密码错误");
        }
        return loginUser;
    }
}
